package week08.company02;

/**
 * Created by zhangxiaokun on 2018/3/21.
        货存部门
 */
public class Stock extends Colleague{
    private static int stockNum = 100;      //库存默认有10台电脑

    public Stock(Mediator mediator) {
        super(mediator);
    }

    //加存量
    public void increase(int number) {
        stockNum += number;
    }

    //减存量
    public void decrease(int number) {
        if (stockNum >= number) {
            stockNum -= number;
        } else  {
            System.out.println("库存不够");
        }
    }

    //获取库存量
    public int getStock() {
        return stockNum;
    }

    //清空库存
    public void clearStock() {
        stockNum = 0;
        System.out.println("清空了仓库里的" + stockNum + "台电脑");
    }

    public void setStockNum(int stockNum) {
        stockNum = stockNum;
    }
}
